home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Devices / ADB Key Spy 1.0.1b3 / ADBKS Read Me < prev    next >
Encoding:
Text File  |  1997-03-07  |  4.8 KB  |  61 lines  |  [TEXT/ttxt]

  1. About ADB Key Spy
  2.  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3.  
  4. © 1995-1997 Apple Computer, Inc.
  5.  
  6.  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  7.  
  8. Originally by: Pete Gontier
  9. Revised and refined by: Quinn “The Eskimo!”
  10. Apple Macintosh Developer Technical Support
  11.  
  12.  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  13.  
  14. This package provides something of a replacement for GetKeys by maintaining a key map reflecting the state of each keyboard attached to the Mac via ADB. (This means it won't work with any Mac earlier than an SE.)
  15.  
  16. The acute intent of the package was to solve a problem a game developer was having with the Adjustable Keyboard, which appears on ADB as two keyboards. The ROM keyboard driver has one map and clears it whenever there is a key state change on a “new” keyboard. Consequently, it was impossible for said developer to allow users to steer on the numeric key pad and fire with the space bar.
  17.  
  18. In addition to solving the problem with the Adjustable Keyboard, this package is now a demonstration of several techniques, including:
  19.  
  20.    • building a system extension
  21.    • using the ADB API
  22.    • “patching” ADB service routines
  23.    • building, installing, and using a driver
  24.    • mapping physical key codes to virtual key codes
  25.  
  26. Although this package does maintain a map for each keyboard, it does not provide an API for polling individual keyboards. You can only find out if a key with a given virtual key code is being held down on any keyboard. If you need to track multiple keyboards separately, I suggest adding to the driver Control and Status selectors for determining the number of keyboards being tracked, polling the Nth keyboard for a given virtual key code, etc.
  27.  
  28. When the extension file is built, it contains three resources, one each for a system extension ('INIT'), a driver ('DRVR'), and a custom code resource which contains the ADB service routine ('AKSR'). For each resource there is a CodeWarrior 11 project. To build the extension, first build "ADBKS Extension π". This will create the file "ADB Key Spy". To merge in the 'DRVR' resource, build "ADBKS Driver π", and to merge in the 'AKSR' resource, build "ADBKS Service Routine π".  The bundled “Metrowerks Build Script” will build the projects for you in the right order.
  29.  
  30. Note that this new version of the sample uses the TradDriverLoaderLib to load the 'DRVR' into the unit table.
  31.  
  32. After tossing "ADB Key Spy" into your Extensions folder and restarting, the 'INIT' resource will run and install the driver, install the ADB service routine, and set up the communication between the driver and the ADB service routine. The 'INIT' resource itself is not resident. The ADB service routine code resource handle is detached and "leaked" into the system heap -- e.g. no program holds onto a copy of the handle. This is perfectly intentional, as access to the handle is not useful once the ADB service routine has been installed.
  33.  
  34. When the extension is completely installed, the ADB service routine will automagically maintain its key state maps while the user types, etc., and the maps can be queried via calls to the driver. After updating its maps, the ADB service routine calls through to the ROM keyboard driver so that GetKeys continues to work and keyboard events continue to be posted.
  35.  
  36. Note that debugging the ADB service routine is difficult, since MacsBug (and likely other debuggers) depend on ADB for keyboard services. Do not attempt to set full-stop breakpoints in the ADB service routine, because they will render your machine unusable until you hit whatever reset button is present on your model. This does not mean you cannot use such things as DebugStr, however; see the comments in "ADBKS Service Routine.c" for details.
  37.  
  38. If you wish to ship ADB Key Spy with your product, please send email via AppleLink to SW.LICENSE or via internet to <sw.license@applelink.apple.com>.
  39.  
  40.  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  41.  
  42. Changes in 1.0.1b1:
  43.  
  44. Removed custom driver install code and integrated with TradDriverLoaderLib.  This sample only contains the parts of TradDriverLoaderLib that are needed for it to function.  TradDriverLoaderLib is a sample in its own right, and you should get its full distribution for more details on it.
  45.  
  46. Fixed a ‘mis-feature’ of the ADB Key Spy DRVR.  It was reference counting its opens and closes, although we all know that the Device Manager only passes the first _Open call through to the device driver and handles automatically by simply returning the refNum of the driver to the client. (“OK, so I was extra paranoid,” says Pete.)
  47.  
  48. Updated projects to CodeWarrior 11.
  49.  
  50. Add “Metrowerks Build Script”, an AppleScript that you can use to rebuild the sample projects in the right order.
  51.  
  52. Updated the “Read Me” file.
  53.  
  54. Changes in 1.0.1b2:
  55.  
  56. Updated to use latest TradDriverLoaderLib.
  57.  
  58. Changes in 1.0.1b3:
  59.  
  60. Updated the fabulous demo app to provide more feedback for a successful test.
  61. Updated the “Read Me” file.